<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Zlib::GzipFile - zlib: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link">Object
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-wrap">::wrap</a>
    <li ><a href="#method-i-close">#close</a>
    <li ><a href="#method-i-closed-3F">#closed?</a>
    <li ><a href="#method-i-comment">#comment</a>
    <li ><a href="#method-i-crc">#crc</a>
    <li ><a href="#method-i-finish">#finish</a>
    <li ><a href="#method-i-level">#level</a>
    <li ><a href="#method-i-mtime">#mtime</a>
    <li ><a href="#method-i-orig_name">#orig_name</a>
    <li ><a href="#method-i-os_code">#os_code</a>
    <li ><a href="#method-i-sync">#sync</a>
    <li ><a href="#method-i-sync-3D">#sync=</a>
    <li ><a href="#method-i-to_io">#to_io</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Zlib::GzipFile">
    <h1 id="class-Zlib::GzipFile" class="class">
      class Zlib::GzipFile
    </h1>

    <section class="description">
    
<p><a href="GzipFile.html"><code>Zlib::GzipFile</code></a> is an abstract class for handling a gzip formatted compressed file. The operations are defined in the subclasses, <a href="GzipReader.html"><code>Zlib::GzipReader</code></a> for reading, and <a href="GzipWriter.html"><code>Zlib::GzipWriter</code></a> for writing.</p>

<p><a href="GzipReader.html"><code>GzipReader</code></a> should be used by associating an IO, or IO-like, object.</p>

<h2 id="class-Zlib::GzipFile-label-Method+Catalogue">Method Catalogue<span><a href="#class-Zlib::GzipFile-label-Method+Catalogue">&para;</a> <a href="#top">&uarr;</a></span></h2>
<ul><li>
<p><a href="GzipFile.html#method-c-wrap"><code>::wrap</code></a></p>
</li><li>
<p>::open (<a href="GzipReader.html#method-c-open"><code>Zlib::GzipReader::open</code></a> and <a href="GzipWriter.html#method-c-open"><code>Zlib::GzipWriter::open</code></a>)</p>
</li><li>
<p><a href="GzipFile.html#method-i-close"><code>close</code></a></p>
</li><li>
<p><a href="GzipFile.html#method-i-closed-3F"><code>closed?</code></a></p>
</li><li>
<p><a href="GzipFile.html#method-i-comment"><code>comment</code></a></p>
</li><li>
<p>comment= (<a href="GzipWriter.html#method-i-comment-3D"><code>Zlib::GzipWriter#comment=</code></a>)</p>
</li><li>
<p><a href="GzipFile.html#method-i-crc"><code>crc</code></a></p>
</li><li>
<p>eof? (<a href="GzipReader.html#method-i-eof-3F"><code>Zlib::GzipReader#eof?</code></a>)</p>
</li><li>
<p><a href="GzipFile.html#method-i-finish"><code>finish</code></a></p>
</li><li>
<p><a href="GzipFile.html#method-i-level"><code>level</code></a></p>
</li><li>
<p>lineno (<a href="GzipReader.html#method-i-lineno"><code>Zlib::GzipReader#lineno</code></a>)</p>
</li><li>
<p>lineno= (<a href="GzipReader.html#method-i-lineno-3D"><code>Zlib::GzipReader#lineno=</code></a>)</p>
</li><li>
<p><a href="GzipFile.html#method-i-mtime"><code>mtime</code></a></p>
</li><li>
<p>mtime= (<a href="GzipWriter.html#method-i-mtime-3D"><code>Zlib::GzipWriter#mtime=</code></a>)</p>
</li><li>
<p><a href="GzipFile.html#method-i-orig_name"><code>orig_name</code></a></p>
</li><li>
<p><a href="GzipFile.html#method-i-orig_name"><code>orig_name</code></a> (<a href="GzipWriter.html#method-i-orig_name-3D"><code>Zlib::GzipWriter#orig_name=</code></a>)</p>
</li><li>
<p><a href="GzipFile.html#method-i-os_code"><code>os_code</code></a></p>
</li><li>
<p>path (when the underlying IO supports path)</p>
</li><li>
<p><a href="GzipFile.html#method-i-sync"><code>sync</code></a></p>
</li><li>
<p><a href="GzipFile.html#method-i-sync-3D"><code>sync=</code></a></p>
</li><li>
<p><a href="GzipFile.html#method-i-to_io"><code>to_io</code></a></p>
</li></ul>

<p>(due to internal structure, documentation may appear under <a href="GzipReader.html"><code>Zlib::GzipReader</code></a> or <a href="GzipWriter.html"><code>Zlib::GzipWriter</code></a>)</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-wrap" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Zlib::GzipReader.wrap(io, ...) { |gz| ... }
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>
                      <div class="method-heading">
                        <span class="method-callseq">
                          Zlib::GzipWriter.wrap(io, ...) { |gz| ... }
                              </span>
                            </div>

                            <div class="method-description">
                              <p>Creates a <a href="GzipReader.html"><code>GzipReader</code></a> or <a href="GzipWriter.html"><code>GzipWriter</code></a> associated with <code>io</code>, passing in any necessary extra options, and executes the block with the newly created object just like File.open.</p>

<p>The <a href="GzipFile.html"><code>GzipFile</code></a> object will be closed automatically after executing the block. If you want to keep the associated IO object open, you may call <a href="GzipFile.html#method-i-finish"><code>Zlib::GzipFile#finish</code></a> method in the block.</p>

                              <div class="method-source-code" id="wrap-source">
            <pre>static VALUE
rb_gzfile_s_wrap(int argc, VALUE *argv, VALUE klass)
{
    return gzfile_wrap(argc, argv, klass, 0);
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-close" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">close</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Closes the <a href="GzipFile.html"><code>GzipFile</code></a> object. This method calls close method of the associated IO object. Returns the associated IO object.</p>

                              <div class="method-source-code" id="close-source">
            <pre>static VALUE
rb_gzfile_close(VALUE obj)
{
    struct gzfile *gz;
    VALUE io;

    TypedData_Get_Struct(obj, struct gzfile, &amp;gzfile_data_type, gz);
    if (!ZSTREAM_IS_READY(&amp;gz-&gt;z)) {
        return Qnil;
    }
    io = gz-&gt;io;
    gzfile_close(gz, 1);
    return io;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-closed-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">closed?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Same as IO#closed?</p>

                              <div class="method-source-code" id="closed-3F-source">
            <pre>static VALUE
rb_gzfile_closed_p(VALUE obj)
{
    struct gzfile *gz;
    TypedData_Get_Struct(obj, struct gzfile, &amp;gzfile_data_type, gz);
    return NIL_P(gz-&gt;io) ? Qtrue : Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-comment" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">comment</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns comments recorded in the gzip file header, or nil if the comments is not present.</p>

                              <div class="method-source-code" id="comment-source">
            <pre>static VALUE
rb_gzfile_comment(VALUE obj)
{
    VALUE str = get_gzfile(obj)-&gt;comment;
    if (!NIL_P(str)) {
        str = rb_str_dup(str);
    }
    return str;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-crc" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">crc</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns CRC value of the uncompressed data.</p>

                              <div class="method-source-code" id="crc-source">
            <pre>static VALUE
rb_gzfile_crc(VALUE obj)
{
    return rb_uint2inum(get_gzfile(obj)-&gt;crc);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-finish" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">finish</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Closes the <a href="GzipFile.html"><code>GzipFile</code></a> object. Unlike <a href="GzipFile.html#method-i-close"><code>Zlib::GzipFile#close</code></a>, this method never calls the close method of the associated IO object. Returns the associated IO object.</p>

                              <div class="method-source-code" id="finish-source">
            <pre>static VALUE
rb_gzfile_finish(VALUE obj)
{
    struct gzfile *gz = get_gzfile(obj);
    VALUE io;

    io = gz-&gt;io;
    gzfile_close(gz, 0);
    return io;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-level" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">level</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns compression level.</p>

                              <div class="method-source-code" id="level-source">
            <pre>static VALUE
rb_gzfile_level(VALUE obj)
{
    return INT2FIX(get_gzfile(obj)-&gt;level);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-mtime" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">mtime</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns last modification time recorded in the gzip file header.</p>

                              <div class="method-source-code" id="mtime-source">
            <pre>static VALUE
rb_gzfile_mtime(VALUE obj)
{
    return rb_time_new(get_gzfile(obj)-&gt;mtime, (time_t)0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-orig_name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">orig_name</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns original filename recorded in the gzip file header, or <code>nil</code> if original filename is not present.</p>

                              <div class="method-source-code" id="orig_name-source">
            <pre>static VALUE
rb_gzfile_orig_name(VALUE obj)
{
    VALUE str = get_gzfile(obj)-&gt;orig_name;
    if (!NIL_P(str)) {
        str = rb_str_dup(str);
    }
    return str;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-os_code" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">os_code</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns OS code number recorded in the gzip file header.</p>

                              <div class="method-source-code" id="os_code-source">
            <pre>static VALUE
rb_gzfile_os_code(VALUE obj)
{
    return INT2FIX(get_gzfile(obj)-&gt;os_code);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-sync" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">sync</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Same as IO#sync</p>

                              <div class="method-source-code" id="sync-source">
            <pre>static VALUE
rb_gzfile_sync(VALUE obj)
{
    return (get_gzfile(obj)-&gt;z.flags &amp; GZFILE_FLAG_SYNC) ? Qtrue : Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-sync-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          sync = flag
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Same as IO.  If flag is <code>true</code>, the associated IO object must respond to the <code>flush</code> method.  While <code>sync</code> mode is <code>true</code>, the compression ratio decreases sharply.</p>

                              <div class="method-source-code" id="sync-3D-source">
            <pre>static VALUE
rb_gzfile_set_sync(VALUE obj, VALUE mode)
{
    struct gzfile *gz = get_gzfile(obj);

    if (RTEST(mode)) {
        gz-&gt;z.flags |= GZFILE_FLAG_SYNC;
    }
    else {
        gz-&gt;z.flags &amp;= ~GZFILE_FLAG_SYNC;
    }
    return mode;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_io" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_io</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Same as IO.</p>

                              <div class="method-source-code" id="to_io-source">
            <pre>static VALUE
rb_gzfile_to_io(VALUE obj)
{
    return get_gzfile(obj)-&gt;io;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

